var mongoose = require('mongoose')
var Schema = mongoose.Schema
var ObjectId = Schema.Types.ObjectId

var userSchema = new Schema({
  username: {type: String},
  password: {type: String},

  gender: {type: String, enum: ['male', 'female']},
  avatar: {type: String},
  firends: [{type: ObjectId, ref: 'User'}],

  updateAt: {type: Date, default: Date.now},
  createdAt: {type: Date, default: Date.now}
})

module.exports = mongoose.model('User', userSchema)
